// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout , PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons';
const brandId = process.env.VUE_APP_BRANDID

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}
export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: 'member/index',
    children: [
      // 会员信息管理
      {
        path: '/member',
        name: 'member',
        component: PageView,
        meta: { title: '会员信息' , keepAlive: false, icon: 'team', permission: [,'updateUserGrade','brandRegister','updateUserRelation','updateBlacklist','updateReceiverInfo']},
        children: [
          {
            path: '/member/register',
            name: 'memRegister',
            component: () => import('@/views/member/register'),
            meta: { title: '快速注册' , keepAlive: false, permission: ['brandRegister']}
          },
          {
            path: '/member/index',
            name: 'memberIndex',
            component: () => import('@/views/member/member'),
            meta: { title: '会员列表' , keepAlive: false, permission: ['updateUserGrade']}
          },
          {
            path: '/member/userAccount',
            name: 'memberUserAccount',
            component: () => import('@/views/member/userAccount'),
            meta: { title: '用户账户信息' , keepAlive: false, permission: ['queryUserAccount']}
          },
          // {
          //   path: '/power/updateUserRelation',
          //   name: 'updateUserRelation',
          //   component: () => import('@/views/power/updateUserRelation'),
          //   meta: { title: '修改用户上下级' , keepAlive: false, permission: ['updateUserRelation']}
          // },
          {
            path: '/member/updatePhone',
            name: 'updatePhone',
            component: () => import('@/views/member/updatePhone'),
            meta: { title: '更换手机号' , keepAlive: false, permission: ['updateUserPhone']}
          },
          // {
          //   path: '/member/delPhone',
          //   name: 'delPhone',
          //   component: () => import('@/views/member/delPhone'),
          //   meta: { title: '注销手机号' , keepAlive: false, permission: ['updateUserPhone']}
          // },
          {
            path: '/member/password',
            name: 'memPassword',
            component: () => import('@/views/member/password'),
            meta: { title: '修改密码' , keepAlive: false, permission: ['updatePassword']}
          },
          {
            path: '/member/black',
            name: 'memBlack',
            component: () => import('@/views/member/black'),
            meta: { title: '黑名单管理' , keepAlive: false, permission: ['updateBlacklist']}
          },
        ]
      },
      // 推广模式管理
     {
       path: '/product',
       name: 'product',
       redirect: '/product/grade',
       component: PageView,
       meta: { title: '推广模式管理' , keepAlive: false, icon: 'audit', permission: ['updateGradeProduct','updateWithdrawConfig','updateGradeUpConfig','checkRegisterTask','updateRecycleSpecTitle','updateRecycleClassify']},
       children: [
         {
           path: '/product/grade',
           name: 'grade',
           component: () => import('@/views/product/product'),
           meta: { title: '产品等级' , keepAlive: false, permission: ['queryGradeProduct','updateGradeProduct']}
         },
          //  {
          //    path: '/product/topUpConfig',
          //    name: 'topUpConfig',
          //    component: () => import('@/views/product/topUpConfig'),
          //    meta: { title: '充值配置' , keepAlive: false, permission: ['updateTopUpConfig']}
          //  },
        //  {
        //    path: '/product/upGrade',
        //    name: 'upGrade',
        //    component: () => import('@/views/product/upGrade'),
        //    meta: { title: '推广升级配置' , keepAlive: false, permission: ['updateGradeUpConfig']}
        //  },
        //  {
        //    path: '/product/awardModel',
        //    name: 'awardModel',
        //    component: () => import('@/views/product/awardModel/layout'),
        //    meta: { title: '层级奖励' , keepAlive: false, permission: ['queryAwardModelConfig','queryAwardModelNumberConfig']},
        //    redirect: '/product/awardModel/awards',
        //    children: [
        //      {
        //        path: '/product/awardModel/awards',
        //        name: 'awardModelAwards',
        //        component: () => import('@/views/product/awardModel/awards'),
        //       //  component: () => import('@/views/product/awardModel/awards/index copy.vue'),
        //        meta: { title: '层级奖励金额' , keepAlive: false, permission: ['queryAwardModelNumberConfig','updateAwardModelNumberConfig']}
        //      },
        //      {
        //        path: '/product/awardModel/config',
        //        name: 'awardModelConfig',
        //        component: () => import('@/views/product/awardModel/config'),
        //        meta: { title: '层级奖励配置' , keepAlive: false, permission: ['queryAwardModelConfig','updateAwardModelConfig']}
        //      },
        //    ]
        //  },
        ]
      },
      // 交易查询
      {
        path: '/order',
        name: 'order',
        component: PageView,
        meta: { title: '订单管理' , keepAlive: false, icon: 'transaction', permission: ['queryTaskBatch','queryTaskSub','queryTransactionOrder','queryExternalReleaseOrderNotify','queryTopUpEvidence','checkTopUpEvidence','auditWithDrawOrder','queryWithDrawOrder','queryTaskDay','queryJTKUnionOrder','queryRecycleOrderForm']},
        children: [
          {
            path: '/order/transaction',
            name: 'transaction',
            component: () => import('@/views/order/transaction'),
            meta: { title: '订单明细' , keepAlive: false, permission: ['queryTransactionOrder']}
          },
          {
            path: '/order/transaction/orderPromise',
            name: 'orderPromise',
            hidden: true,
            component: () => import('@/views/order/transaction/orderPromise'),
            meta: { title: '异步回调查询' , keepAlive: false, permission: ['queryExternalReleaseOrderNotify']}
          },
          // {
          //   path: '/order/rewardRanking',
          //   name: 'rewardRanking',
          //   component: () => import('@/views/order/rewardRanking'),
          //   meta: { title: '用户打赏排行' , keepAlive: false, permission: ['queryRewardRanking']}
          // },
          {
            path: '/order/rewardOrder',
            name: 'rewardOrder',
            component: () => import('@/views/order/rewardOrder'),
            meta: { title: '用户打赏记录' , keepAlive: false, permission: ['queryRewardOrderForm']}
          },
          {
            path: '/order/withdrawOrder',
            name: 'withdrawOrder',
            component: () => import('@/views/order/withdrawOrder'),
            meta: { title: '提现订单' , keepAlive: false, permission: ['auditWithDrawOrder','queryWithDrawOrder']}
          },
        ]
      },
      {
        path: '/brandManage',
        name: 'brandManage',
        redirect: '/brandManage/brandConfig',
        component: PageView,
        meta: { title: '运营管理' , keepAlive: false, icon: 'project', permission: ['updateBrandConfig','updatePayChannelGradeRateConfig','queryAwardModelConfig','queryAwardModelNumberConfig','queryCardChannelConfig','updateCardChannelConfig','upadteQuickChannelConfig','updateBrandAllChannelConfig','updateQuickUser']},
        children: [
          {
            path: '/brandManage/brandConfig',
            name: 'brandConfig',
            component: () => import('@/views/brandManage/brandConfig'),
            meta: { title: '品牌信息' , keepAlive: false, permission: ['queryBrandConfig','updateBrandConfig']}
          },
          {
            path: '/brandManage/reasons',
            name: 'brandConfigReasons',
            component: () => import('@/views/brandManage/news/reasons'),
            meta: { title: '借款事由' , keepAlive: false, permission: ['updateBanner']}
          },
          {
            path: '/brandManage/news',
            name: 'news',
            component: () => import('@/views/brandManage/news/layout'),
            meta: { title: '活动新闻管理' , keepAlive: false, permission: ['queryBanner','updateBanner','queryNewsClassification']},
            redirect: '/brandManage/news/news',
            children: [
              {
                path: '/brandManage/news/news',
                name: 'brandManageNews',
                component: () => import('@/views/brandManage/news/news'),
                meta: { title: '活动新闻信息' , keepAlive: false, permission: ['queryBanner','updateBanner']}
              },
              {
                path: '/brandManage/news/classification',
                name: 'brandManageNewsClassification',
                component: () => import('@/views/brandManage/news/classification'),
                meta: { title: '活动分类配置' , keepAlive: false, permission: ['updateNewsClassification','queryNewsClassification']}
              },
            ]
          },
          // {
          //   path: '/brandManage/channelConfig',
          //   name: 'channelConfig',
          //   component: () => import('@/views/brandManage/channelConfig'),
          //   meta: { title: '通道配置' , keepAlive: false, permission: ['queryBrandChannelConfig','updateBrandChannelConfig','updateAllChannelConfig']}
          // },
          // {
          //   path: '/rewardCenter/withdraw',
          //   name: 'rewardCenterWithdraw',
          //   component: () => import('@/views/product/withdraw'),
          //   meta: { title: '提现配置' , keepAlive: false, permission: ['updateWithdrawConfig',]}
          // },
          {
            path: '/brandManage/wechatLoginConfig',
            name: 'wechatLoginConfig',
            component: () => import('@/views/brandManage/wechatLoginConfig'),
            meta: { title: '微信登录配置' , keepAlive: false, permission: ['updateWechatConfig']}
          },
          // {
          //   path: '/brandManage/payChatConfig',
          //   name: 'payChatConfig',
          //   component: () => import('@/views/brandManage/payChatConfig'),
          //   meta: { title: '微信支付配置' , keepAlive: false, permission: ['updateWebWechatAppId']}
          // },
          // {
          //   path: '/brandManage/aliTransferAccount',
          //   name: 'aliTransferAccount',
          //   component: () => import('@/views/brandManage/aliTransferAccount'),
          //   meta: { title: '支付宝代付账户' , keepAlive: false, permission: ['queryBrandAliTransferAccount','updateBrandAliTransferAccount']}
          // },
          // {
          //   path: '/brandManage/topUpAccount',
          //   name: 'topUpAccount',
          //   component: () => import('@/views/brandManage/topUpAccount'),
          //   meta: { title: '支付宝充值帐户配置' , keepAlive: false, permission: ['queryBrandTopUpAccount','updateBrandTopUpAccount']}
          // },
          // {
          //   path: '/brandManage/aliWapPayAccount',
          //   name: 'aliWapPayAccount',
          //   component: () => import('@/views/brandManage/aliWapPayAccount'),
          //   meta: { title: '支付宝WAP支付账户' , keepAlive: false, permission: ['queryBrandAliWAPPayAccount','updateBrandAliWAPPayAccount']}
          // },
          
        ]
      },
      // 个人信息
      // {
      //   path: '/userInfo',
      //   name: 'userInfo',
      //   component: PageView,
      //   meta: { title: '个人信息' , keepAlive: false, icon: 'user', permission: ['queryExternalMerchantInfo','updatePassword','updateBrandTopUpAccount']},
      //   children: [
      //     // {
      //     //   path: '/user/userInfo',
      //     //   name: 'userUserInfo',
      //     //   component: () => import('@/views/user/UserInfo'),
      //     //   meta: { title: '个人信息' , keepAlive: false, permission: ['queryExternalMerchantInfo']}
      //     // },
      //     {
      //       path: '/user/userAccountHistory',
      //       name: 'userAccountHistory',
      //       component: () => import('@/views/user/userAccountHistory'),
      //       meta: { title: '余额变动历史' , keepAlive: false, permission: ['queryExternalMerchantInfo']}
      //     },
      //     {
      //       path: '/user/password',
      //       name: 'memPassword',
      //       component: () => import('@/views/member/password'),
      //       meta: { title: '修改密码' , keepAlive: false, permission: ['updatePassword']}
      //     },
      //     {
      //       path: '/user/topUpAccount',
      //       name: 'topUpAccount',
      //       component: () => import('@/views/user/topUpAccount'),
      //       meta: { title: '充值账户管理' , keepAlive: false, permission: ['updateBrandTopUpAccount']}
      //     },
      //   ]
      // },
      // 权限管理
      {
        path: '/power',
        name: 'power',
        component: PageView,
        meta: { title: '权限管理' , keepAlive: false, icon: 'lock', permission: ['updateRoleUser','setUserIgnorePassword']},
        children: [
          {
            path: '/power/developmentLogin',
            name: 'developmentLogin',
            component: () => import('@/views/power/developmentLogin'),
            meta: { title: '测试人员登录账号' , keepAlive: false, permission: ['setUserIgnorePassword']}
          },
          {
            path: '/power/uploadOss',
            name: 'uploadOss',
            component: () => import('@/views/power/uploadOss'),
            meta: { title: '文件生成链接' , keepAlive: false, permission: ['uploadBrandFile']}
          },
          {
            path: '/power/roles',
            name: 'roles',
            component: () => import('@/views/power/roles/layout'),
            meta: { title: '角色权限配置' , keepAlive: false, permission: ['updateRoleUser','updateRoleResource','updateRoleName','updateResourceGroup','updateResource']},
            redirect: '/power/roles/resourceGroup',
            children: [
              {
                path: '/power/roles/userRole',
                name: 'userRole',
                component: () => import('@/views/power/roles/userRole'),
                meta: { title: '已配置角色用户' , keepAlive: false, permission: ['updateRoleUser']}
              },
              {
                path: '/power/roles/roleResource',
                name: 'roleResource',
                component: () => import('@/views/power/roles/roleResource'),
                meta: { title: '角色资源配置' , keepAlive: false, permission: ['updateRoleResource']}
              },
              {
                path: '/power/roles/role',
                name: 'role',
                component: () => import('@/views/power/roles/role'),
                meta: { title: '角色配置' , keepAlive: false, permission: ['updateRoleName']}
              },
              {
                path: '/power/roles/resourceGroup',
                name: 'resourceGroup',
                component: () => import('@/views/power/roles/resourceGroup'),
                meta: { title: '资源组配置' , keepAlive: false, permission: ['updateResourceGroup']}
              },
              {
                path: '/power/roles/resource',
                name: 'resource',
                component: () => import('@/views/power/roles/resource'),
                meta: { title: '资源配置' , keepAlive: false, permission: ['updateResource']}
              },
            ]
          },
        ]
      },
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
